module.exports = (sequelize, Sequelize) => {
    const comment = sequelize.define('comment', {
      comment_id: {
        type: Sequelize.INTEGER,
        autoIncrement: true,
        primaryKey: true
      },
      comment_content: {
        type: Sequelize.TEXT,
        allowNull: false
      },
      blog_id: {
        type: Sequelize.STRING(50),
        allowNull: false,
      },
      user_id: {
        type: Sequelize.STRING(50),
        allowNull: false,
      },
      comment_time: {
        type: Sequelize.DATE,
        allowNull: false,
        defaultValue: Sequelize.NOW,
        get() {
          const date = this.getDataValue('comment_time')
          return date ? date.toISOString().slice(0, 10) : null
        }
      }
    }, {
      timestamps: false,
      underscored: true,
      tableName: 'comment'
    })
    return comment
  }